package GUI;

import Logica.Pen;

import java.awt.Color;
import java.awt.Dimension;

import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

public class AgregarJaula extends JFrame {
  private JLabel jlabelAgregarJaula = new JLabel();
  private JLabel jlCapacity = new JLabel();
  private JLabel jlabelStatus = new JLabel();
  private JLabel jlabelClinic = new JLabel();
  private JButton jButtonGuardarJaula = new JButton();
  private JFormattedTextField jFormCap = new JFormattedTextField();
  private JFormattedTextField jFormStatus = new JFormattedTextField();
  private JFormattedTextField jFormNumCli = new JFormattedTextField();
  private JTextField jTextField1 = new JTextField();

  Pen pen = new Pen();

  public AgregarJaula() {
    try {
      jbInit();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void jbInit() throws Exception {
    this.getContentPane().setLayout(null);
    this.setSize(new Dimension(525, 424));
    this.setTitle("Agregar Jaula");
    this.setFont(new Font("Dialog", 0, 20));
    jlabelAgregarJaula.setText("AGREGAR JAULA");
    jlabelAgregarJaula.setBounds(new Rectangle(175, 20, 160, 50));
    jlabelAgregarJaula.setFont(new Font("Tahoma", 0, 20));
    jlabelAgregarJaula.setForeground(new Color(15, 9, 189));
    jlCapacity.setText("Capacidad");
    jlCapacity.setBounds(new Rectangle(20, 115, 160, 40));
    jlCapacity.setFont(new Font("Tahoma", 0, 14));
    jlabelStatus.setText("Estado");
    jlabelStatus.setBounds(new Rectangle(20, 160, 160, 40));
    jlabelStatus.setFont(new Font("Tahoma", 0, 14));
    jlabelClinic.setText("No.  Clinica");
    jlabelClinic.setBounds(new Rectangle(15, 215, 105, 40));
    jlabelClinic.setFont(new Font("Tahoma", 0, 14));
    jButtonGuardarJaula.setText("GUARDAR");
    jButtonGuardarJaula.setBounds(new Rectangle(325, 310, 130, 40));
    jButtonGuardarJaula.setFont(new Font("Arial Black", 0, 11));

    jButtonGuardarJaula.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          jButtonGuardarJaula_actionPerformed(e);
        }
      });
    jFormCap.setBounds(new Rectangle(120, 120, 160, 40));
    jFormStatus.setBounds(new Rectangle(120, 170, 160, 35));
    jFormNumCli.setBounds(new Rectangle(120, 220, 160, 35));
    jTextField1.setBounds(new Rectangle(410, 515, 5, 20));

    this.getContentPane().add(jTextField1, null);
    this.getContentPane().add(jFormNumCli, null);
    this.getContentPane().add(jFormStatus, null);
    this.getContentPane().add(jFormCap, null);
    this.getContentPane().add(jButtonGuardarJaula, null);
    this.getContentPane().add(jlabelClinic, null);
    this.getContentPane().add(jlabelStatus, null);
    this.getContentPane().add(jlCapacity, null);
    this.getContentPane().add(jlabelAgregarJaula, null);


  }
  private void jButtonGuardarJaula_actionPerformed(ActionEvent e) {
    if (pen.creaPen(jFormCap.getText().toString(), jFormStatus.getText().toString(),
                    jFormNumCli.getText().toString())) {
      JOptionPane.showMessageDialog(null, "Creado",
                                    "La Jaula ha sido creado",
                                    JOptionPane.INFORMATION_MESSAGE);
    } else {
      JOptionPane.showMessageDialog(null, "No Creado",
                                    "La Jaula no ha sido creado",
                                    JOptionPane.ERROR_MESSAGE);

    }
  }
}
